package cn.agiledata.bank.transaction.service;

import cn.agiledata.bank.common.util.ConvertUtil;
import com.vnv.infrastructure.logic.IPBHibernate3BaseMgr;

public class FeeRatioEncap extends IPBHibernate3BaseMgr {
	
	Double bankFeeRatio = new Double(1.2);//银行费率
	//Double feeRatio = new Double(0);    //支付系统费率	


	public double getDebitFee(double amount,double bankFeeRatio) {
		//付款方费用
		double debitFee = 0;
		if (amount>0)
			debitFee=amount*bankFeeRatio/100 + 0.0000001;
		else
			debitFee=amount*bankFeeRatio/100 - 0.0000001;		
	
		return Double.valueOf(ConvertUtil.parseDec(new Double(debitFee),"0.00")).doubleValue();
	}
	
	public double getCreditFee(double amount,double feeRatio){
		//收款方费用
		double creditFee= 0;
		if (amount>0)
			creditFee=amount*feeRatio/100 + 0.0000001;
		else
			creditFee=amount*feeRatio/100 - 0.0000001;
		
		return Double.valueOf(ConvertUtil.parseDec(new Double(creditFee),"0.00")).doubleValue();
	}
}
